'''
Created on Aug 23, 2012

@author: bbg
'''

import dbwrapper
from dbwrapper.shopx.class_statistic_anlysis import ClassStatisticAnlysis
 
def classStatisticAnlysisTest():
    dbsession = dbwrapper.MySqlSession()
    
    company_id = 1
    shop_id = 1
    ClassStatisticAnlysis.doMapping(company_id, shop_id)
    
    newClassStatisticAnlysis = ClassStatisticAnlysis()
    newClassStatisticAnlysis.class_rank = 0
    newClassStatisticAnlysis.amount_discount = 1111
    newClassStatisticAnlysis.discount_amount = 1000
    
    dbsession.add(newClassStatisticAnlysis)
    
    queryclassStatisticAnlysisTest = dbsession.query(ClassStatisticAnlysis).filter(ClassStatisticAnlysis.class_rank == 0)
    
    dbsession.commit()
    
    print queryclassStatisticAnlysisTest.first().amount_discount
    
    dbsession.close()
    
    
if __name__ == "__main__":
    classStatisticAnlysisTest()